<script type="text/javascript">


function delid(id) {
    
    $("#del").attr("href", "delpage/"+id);
    return true;
};
</script>
<table  class="table">
    <thead>
    <th>Код</th>
    <th>Имя</th>
    </thead>
<?php foreach ($pages as $row_page): ?>
    <tr>
        <td><span class="label label-info">ID</span></td>  <td><?php echo $row_page['id']; ?></td>       
    </tr>
    <tr>
        <td><span class="label label-info">title</span></td><td><?php echo $row_page['title']; ?></td>
    </tr>
    <tr>
        <td><span class="label label-info">category</span></td><td><?php echo $row_page['cat']; ?></td>
    </tr>
    <tr>
        <td><span class="label label-info">link</span></td><td><?php echo $row_page['link']; ?></td>
    </tr>
    <tr>
        <td><span class="label label-info">text</span></td><td><?php echo $row_page['text']; ?></td>
    </tr>
    <tr>
        <td><a  href="<?php echo  site_url('admin/admin/page_edit/'.$row_page['id']);?>" class="btn btn-primary">Редактировать статью</a></td>
        <td><a href="/delpage" data-target="#myModal" data-toggle="modal" onclick="delid(<?=  $row_page['id']; ?>)" class="btn btn-danger">Удалить</a></td>
    </tr>
    


<?php endforeach; ?>
    <tr><td><a  href="<?php echo  site_url('admin/admin/page_add');?>">Добавить статью</a></td><td></td> </tr>
    
</table>

<div class="pagination text-center">
    <ul>
    <?php echo $pager; ?>
    </ul>
</div>

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">Modal header</h3>
    </div>
    <div class="modal-body">
        <p>Действительно удалить?</p>
    </div>
    <div class="modal-footer">
        <a href="#" class="btn" data-dismiss="modal">Нет</a>
        <a href="#" class="btn btn-primary" id="del">Удалить</a>
    </div>
</div>